package com.wanhai.itm.wditm145.lov;

import com.wanhai.vo.itm.ITM3012VO;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listgroup;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

/**
 *
 * @author Richard Shih
 */
public class PlanitemListRenderer implements ListitemRenderer<Object> {

    public void render(Listitem row, Object obj, int i) throws Exception {

        if (row instanceof Listgroup) {

            Listcell cell = new Listcell();
            cell.setStyle("font-size:0.9em;font-weight:bold;");
            if (String.valueOf(obj).isEmpty()) {
                cell.setLabel("Others");
            } else {
                cell.setLabel(String.valueOf(obj));
            }
            row.appendChild(cell);
            row.setValue(obj);
        } else {
            ITM3012VO itm3012 = (ITM3012VO) obj;
            row.appendChild(new Listcell(itm3012.getITEMNO()));
            row.appendChild(new Listcell(itm3012.getITEMNM_C()));
            row.appendChild(new Listcell(itm3012.getITEMNM_E()));
            row.setValue(itm3012);
        }
    }
}
